from core.database import db_getter
from apps.dispatch.taskpool.crud import TaskPoolDal
from core.logger import logger_task
from datetime import datetime

async def dispatch_task():
    async for db in db_getter():
        logger_task.info(f'dispatch task {datetime.now()}')
        print(f"测试, 定时任务运行 {datetime.now()}")
        try:
            await TaskPoolDal(db).fetch_tasks()
        except Exception as e:
            print('同步失败', e)

